﻿<Window x:Class="TeamBuildScreen.Core.Views.ScreenSaverSettings"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:m="clr-namespace:TeamBuildScreen.Core.Models"
        Title="Team Build Screen Settings" Width="561.719" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:views="clr-namespace:TeamBuildScreen.Core.Views"
        xmlns:converters="clr-namespace:TeamBuildScreen.Core.Views.Converters"
        mc:Ignorable="d" ResizeMode="NoResize"
        SizeToContent="Height" WindowStartupLocation="CenterScreen" WindowStyle="ThreeDBorderWindow">
    <Window.Background>
        <LinearGradientBrush>
            <GradientStop Color="#FF2B2077" Offset="4"/>
            <GradientStop Color="#FFFFFFFF" Offset="0"/>
        </LinearGradientBrush>
    </Window.Background>
    <StackPanel Margin="8">
        <Grid Margin="0,0,0,8">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="151"/>
                <ColumnDefinition Width="8" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="8" />
                <ColumnDefinition Width="86" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="28" />
            </Grid.RowDefinitions>
            <Label Height="28" Grid.Column="0" HorizontalContentAlignment="Right" FontWeight="Bold" Content="Team Foundation Server:" />
            <TextBox Grid.Column="2" Text="{Binding Path=TfsUri}" IsReadOnly="True" TextWrapping="NoWrap" />
            <Button Command="{Binding RequestSelectServer}" Grid.Column="4" Content="Select..."/>
        </Grid>
        <StackPanel Margin="0,0,0,8">
            <Label Height="28" FontWeight="Bold" Content="Build Definitions:" />
            <StackPanel Margin="0,0,0,8" Orientation="Horizontal">
                <ListView SelectionMode="Single" Height="287" ItemsSource="{Binding Path=Builds}"
                          Background="#7FFFFFFF" x:Name="BuildsListView" SelectedItem="{Binding Path=selectedItem}" Width="488">
                    <ListView.ItemContainerStyle>
                        <Style TargetType="ListViewItem">
                            <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                        </Style>
                    </ListView.ItemContainerStyle>
                    <ListView.View>
                        <GridView AllowsColumnReorder="True">
                            <GridViewColumn>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center"
                                                  IsChecked="{Binding Path=IsEnabled}" Margin="2,0,2,0" />
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Team Project" DisplayMemberBinding="{Binding Path=TeamProject}" />
                            <GridViewColumn Header="Build Definition"
                                            DisplayMemberBinding="{Binding Path=DefinitionName}" Width="175" />
                            <GridViewColumn Header="Configuration">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox IsEditable="True" Text="{Binding Path=Configuration}"
                                                  IsEnabled="{Binding Path=IsEnabled}" VerticalAlignment="Center"
                                                  Margin="2,0,2,0">
                                            <ComboBoxItem Content="Release" />
                                            <ComboBoxItem Content="Debug" />
                                        </ComboBox>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Header="Platform">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox IsEditable="True" Text="{Binding Path=Platform}"
                                                  IsEnabled="{Binding Path=IsEnabled}" VerticalAlignment="Center"
                                                  Margin="2,0,2,0">
                                            <ComboBoxItem Content="Any CPU" />
                                        </ComboBox>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
                <StackPanel Orientation="Vertical" VerticalAlignment="Center">
                    <StackPanel.Resources>
                        <converters:MoveUpConverter x:Key="MoveUpConverter" />
                        <converters:MoveDownConverter x:Key="MoveDownConverter" />
                    </StackPanel.Resources>
                    <Button Margin="8,0,0,0" Width="30" Command="{Binding RequestMoveUp}"
                            IsEnabled="{Binding ElementName=BuildsListView,Path=SelectedItem, Converter={StaticResource MoveUpConverter}}"
                            CommandParameter="{Binding ElementName=BuildsListView,Path=SelectedItem}"
                            FontFamily="Marlett" FontSize="20" Content="5" />
                    <Button Margin="8,8,0,0" Width="30" Command="{Binding RequestMoveDown}"
                            IsEnabled="{Binding ElementName=BuildsListView,Path=SelectedItem, Converter={StaticResource MoveDownConverter}}"
                            CommandParameter="{Binding ElementName=BuildsListView,Path=SelectedItem}"
                            FontFamily="Marlett" FontSize="20" Content="6" />
                </StackPanel>
            </StackPanel>
        </StackPanel>
        <GroupBox Header="Display" Margin="0,0,0,16" Padding="4" Height="171">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="165"/>
                    <ColumnDefinition Width="8" />
                    <ColumnDefinition Width="109" />
                    <ColumnDefinition Width="8" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="28" />
                    <RowDefinition Height="8" />
                    <RowDefinition Height="28" />
                    <RowDefinition Height="8" />
                    <RowDefinition Height="28" />
                    <RowDefinition Height="8" />
                    <RowDefinition Height="28" />
                </Grid.RowDefinitions>
                <Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" FontWeight="Bold" Content="Columns:"/>
                <ComboBox SelectedValue="{Binding Path=Columns}" SelectedValuePath="Content" Grid.Row="0" Grid.Column="2">
                    <ComboBoxItem Content="1"/>
                    <ComboBoxItem Content="2"/>
                    <ComboBoxItem Content="3"/>
                    <ComboBoxItem Content="4"/>
                    <ComboBoxItem Content="5"/>
                </ComboBox>
                <Label HorizontalContentAlignment="Right" FontWeight="Bold" Content="Refresh every:" Grid.Row="2" Grid.Column="0" />
                <ComboBox VerticalContentAlignment="Center" SelectedValue="{Binding Path=UpdateInterval}" SelectedValuePath="Tag" Grid.Row="2" Grid.Column="2">
                    <ComboBoxItem Content="15 seconds" Tag="15000" />
                    <ComboBoxItem Content="30 seconds" Tag="30000" />
                    <ComboBoxItem Content="45 seconds" Tag="45000" />
                    <ComboBoxItem Content="60 seconds" Tag="60000" />
                </ComboBox>
                <Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" FontWeight="Bold" Content="Fade Build Panels After:"/>
                <ComboBox SelectedValue="{Binding Path=StaleThreshold}" SelectedValuePath="Tag" Grid.Row="4" Grid.Column="2">
                    <ComboBoxItem Content="1 day" Tag="1" />
                    <ComboBoxItem Content="2 days" Tag="2" />
                    <ComboBoxItem Content="5 days" Tag="5" />
                    <ComboBoxItem Content="1 week" Tag="7" />
                    <ComboBoxItem Content="1 month" Tag="30" />
                </ComboBox>
                <Label HorizontalContentAlignment="Left" Grid.Column="4" Grid.Row="4" Content="(since completed)" FontStyle="Italic" Foreground="Gray" />
                <Label HorizontalContentAlignment="Right" Grid.Row="6" Grid.Column="0" FontWeight="Bold" Content="Team Project name format:"/>
                <ComboBox SelectedValue="{Binding Path=CurrentTeamProjectNameFormat}" SelectedValuePath="Tag" Grid.Row="6" Grid.Column="2">
                    <ComboBoxItem Content="None" Tag="None" />
                    <ComboBoxItem Content="Short" Tag="Short" />
                    <ComboBoxItem Content="Full" Tag="Full" />
                </ComboBox>
            </Grid>
        </GroupBox>
        <StackPanel Orientation="Horizontal" Height="28" HorizontalAlignment="Right">
            <Button Width="90" Command="{Binding RequestSave}" Content="Save"/>
            <Button Margin="8,0,0,0" Width="90" Command="{Binding RequestClose}" Content="Close"/>
        </StackPanel>
    </StackPanel>
</Window>
